﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using DevExpress.Web.ASPxGridView;
using DevExpress.Web.ASPxTreeList;
using SGRapidForm.Permission.Service.Interface;
using SGRapidForm.Common;
using SGRapidForm.Permission.Entity;

namespace SGDemo.Permission
{
    public partial class HelpList : System.Web.UI.Page
    {
        private IPermissionService _permissionService = ServiceProxyFactory.Create<IPermissionService>("permissionservice");
        protected void Page_Load(object sender, EventArgs e)
        {
            JSManager.RegAjax(Header, this.GetType().BaseType);
        }

        /// <summary>
        /// 自定义GridView回调重新绑定
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void gvwList_CustomCallback(object sender, ASPxGridViewCustomCallbackEventArgs e)
        {
            gvwList.PageIndex = 0;
            gvwList.DataBind();
        }
        /// <summary>
        /// TreeList重新绑定
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void tlList_CustomCallback(object sender, TreeListCustomCallbackEventArgs e)
        {
            tlList.DataBind();
            tlList.ExpandToLevel(2);
        }
        /// <summary>
        /// 批量删除
        /// </summary>
        /// <param name="keyids">Keyids集合</param>
        /// <returns>是否删除成功</returns>
        [AjaxPro.AjaxMethod]
        public bool BulkDelete(string keyids)
        {

            return _permissionService.Help_BulkDelete(keyids);
        }


    }

    public class HelpListDataSource
    {

        private IPermissionService _permissionService = ServiceProxyFactory.Create<IPermissionService>("permissionservice");
        public List<Help> PagingGetHelp(Int32 startRecord, Int32 maxRecords, String sortColumns, String filterConditions)
        {
            return _permissionService.Help_PagingGetHelp(startRecord, maxRecords, sortColumns,filterConditions);
        }

        public int PagingGetHelpCount(String filterConditions)
        {
            return _permissionService.Help_PagingGetHelpCount(filterConditions);
        }
    }
}